package com.example.gameforum.entity;


import javax.persistence.*;
import java.util.List;

//用户
@Entity
public class User {

    @Id
    @Column(name = "id", nullable = false)
    private int id;

    //密码
    @Column(name = "password")
    private String password;

    //昵称
    @Column(name = "name")
    private String name;

    //头像
    @Column(name = "picurl")
    private String picurl;

    //签名signature
    @Column(name = "signatrue")
    private String signatrue;

    //地址
    @Column(name = "address")
    private String address;


    //帖子一对多
    @OneToMany(mappedBy = "puser",cascade= CascadeType.ALL,fetch=FetchType.LAZY)
    private List<Post> posts;

    //评论一对多
    @OneToMany(mappedBy = "cuser",cascade= CascadeType.ALL,fetch=FetchType.LAZY)
    private List<Comment> comments;

    //收藏一对多
    @OneToMany(mappedBy = "fuser",cascade= CascadeType.ALL,fetch=FetchType.LAZY)
    private List<Favorite> favorites;


    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPicurl() {
        return picurl;
    }

    public void setPicurl(String picurl) {
        this.picurl = picurl;
    }

    public String getSignatrue() {
        return signatrue;
    }

    public void setSignatrue(String signatrue) {
        this.signatrue = signatrue;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public List<Post> getPosts() {
        return posts;
    }

    public void setPosts(List<Post> posts) {
        this.posts = posts;
    }

    public List<Comment> getComments() {
        return comments;
    }

    public void setComments(List<Comment> comments) {
        this.comments = comments;
    }

    public List<Favorite> getFavorites() {
        return favorites;
    }

    public void setFavorites(List<Favorite> favorites) {
        this.favorites = favorites;
    }
}
